#include <iostream>
#include "Search.h"
#include "CountSearch.h"
#include "Mutex.h"

using namespace std;

#define WORKER 100

int abc[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };

int s_count = 0;
bool s_found = false;
Mutex *s_mutex;


void main ()
{
	s_mutex = new Mutex();
	s_mutex->init();

	//count 
	CountSearch *countSearch = new CountSearch();
	countSearch->start();

	//search
	for ( int i = 0; i < WORKER; i++ )
	{
		Search *search = new Search( abc );
		search->start();
		search->join();
	}

	cout << endl << "Result find target: " << TARGET_FIND << " is " << s_count << endl;
	system ( "pause" );
}
